package com.hspedu.seckill.rabbitmq;

import com.hspedu.seckill.pojo.nameMQ;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 消息生产者
 */
@Service
@Slf4j
public class MQSenderMessage {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    //发送秒杀消息
    public void sendSeckillMessage(String message){
        log.info("发送消息:{}",message);
        rabbitTemplate.convertAndSend(nameMQ.EXCHANGE,"seckill.message",message);
    }
}
